home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
earcd
/
util
/
time
/
autorebo.lha
/
AutoReboot
/
AutoReboot.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-12-27
|
792b
|
43 lines
#include <stdio.h>
#include <stdlib.h>
#include "functions.h"
#define VERSION_NUM "1.0"
#define VERSION_DAT "(27.12.96)"
char *version="$VER: AutoReboot "VERSION_NUM" "VERSION_DAT;
main(int argc, char * argv[])
{
FILE * checkfile=NULL;
if(argc!=3)
{
printf("AutoReboot "VERSION_NUM" by Ralf Gruner.\nUsage: AutoReboot <filename> <seconds>\n");
exit(5);
}
for(;;)
{
Delay(atoi(argv[2])*50);
if(NULL==(checkfile=fopen(argv[1],"r")))
{
/* Falls Datei evtl. gerade geschrieben wird */
Delay(100);
if(NULL==(checkfile=fopen(argv[1],"r")))
{
ColdReboot(); // wenn Datei nicht existiert
}
}
if(fclose(checkfile)!=0)
{
ColdReboot(); // wenn Fehler beim Schließen
}
if(remove(argv[1])!=0)
{
ColdReboot(); // wenn Fehler beim Löschen
}
}
}